[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Syntax
C# |
---|
[SerializableAttribute] public class OrderedDictionary<TKey, TValue> |
Visual Basic (Declaration) |
---|
<SerializableAttribute> _ Public Class OrderedDictionary(Of TKey, TValue) |
Visual C++ |
---|
[SerializableAttribute] generic<typename TKey, typename TValue> public ref class OrderedDictionary |
Type Parameters
- TKey
- TValue
The type exposes the following methods.
Public Methods
Name | Description | |
---|---|---|
Add | Overloaded. | |
AddMany |
Adds multiple key-value pairs to a dictionary. If a key exists in both the current instance and dictionaryToAdd,
then the value is updated with the value from keysAndValues> (no exception is thrown).
Since IDictionary<TKey,TValue> inherits from IEnumerable<KeyValuePair<TKey,TValue>>, this
method can be used to merge one dictionary into another.
| |
AsReadOnly |
Provides a read-only view of this dictionary. The returned IDictionary<TKey,TValue> provides
a view of the dictionary that prevents modifications to the dictionary. Use the method to provide
access to the dictionary without allowing changes. Since the returned object is just a view,
changes to the dictionary will be reflected in the view.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
Clear |
Removes all keys and values from the dictionary.
(Overrides DictionaryBase<(Of <TKey, TValue>)>..::Clear()().) | |
Clone |
Makes a shallow clone of this dictionary; i.e., if keys or values of the
dictionary are reference types, then they are not cloned. If TKey or TValue is a value type,
then each element is copied as if by simple assignment.
| |
CloneContents |
Makes a deep clone of this dictionary. A new dictionary is created with a clone of
each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is
a value type, then each element is copied as if by simple assignment.
| |
Contains |
Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the
dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals)
the value.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
ContainsKey |
Determines if this dictionary contains a key equal to key. The dictionary
is not changed.
(Overrides DictionaryBase<(Of <TKey, TValue>)>..::ContainsKey(TKey).) | |
ConvertAll<(Of <TOutput>)> |
Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration
contains the result of applying converter to each item in this collection, in
order.
(Inherited from CollectionBase<(Of <T>)>.) | |
CopyTo |
Copies all the items in the collection into an array. Implemented by
using the enumerator returned from GetEnumerator to get all the items
and copy them to the provided array.
(Inherited from CollectionBase<(Of <T>)>.) | |
CountWhere |
Counts the number of items in the collection that satisfy the condition
defined by predicate.
(Inherited from CollectionBase<(Of <T>)>.) | |
Equals | (Inherited from Object.) | |
Exists |
Determines if the collection contains any item that satisfies the condition
defined by predicate.
(Inherited from CollectionBase<(Of <T>)>.) | |
FindAll |
Enumerates the items in the collection that satisfy the condition defined
by predicate.
(Inherited from CollectionBase<(Of <T>)>.) | |
ForEach |
Performs the specified action on each item in this collection.
(Inherited from CollectionBase<(Of <T>)>.) | |
GetEnumerator |
Returns an enumerator that enumerates all the entries in the dictionary. Each entry is
returned as a KeyValuePair<TKey,TValue>.
The entries are enumerated in the sorted order of the keys.
(Overrides CollectionBase<(Of <KeyValuePair<(Of <TKey, TValue>)>>)>..::GetEnumerator()().) | |
GetHashCode | Serves as a hash function for a particular type. GetHashCode()() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetValueElseAdd |
Finds a key in the dictionary. If the dictionary already contains
a key equal to the passed key, then the existing value is returned via value. If the dictionary
doesn't contain that key, then value is associated with that key.
| |
Range |
Returns a collection that can be used for enumerating some of the keys and values in the collection.
Only keys that are greater than from and
less than to are included. The keys are enumerated in sorted order.
Keys equal to the end points of the range can be included or excluded depending on the
fromInclusive and toInclusive parameters.
| |
RangeFrom |
Returns a collection that can be used for enumerating some of the keys and values in the collection.
Only keys that are greater than (and optionally, equal to) from are included.
The keys are enumerated in sorted order. Keys equal to from can be included
or excluded depending on the fromInclusive parameter.
| |
RangeTo |
Returns a collection that can be used for enumerating some of the keys and values in the collection.
Only items that are less than (and optionally, equal to) to are included.
The items are enumerated in sorted order. Items equal to to can be included
or excluded depending on the toInclusive parameter.
| |
Remove |
Removes a key from the dictionary. This method must be overridden in the derived class.
| |
RemoveAll |
Removes all the items in the collection that satisfy the condition
defined by predicate.
(Inherited from CollectionBase<(Of <T>)>.) | |
RemoveMany |
Removes all the keys found in another collection (such as an array or List<TKey>). Each key in keyCollectionToRemove
is removed from the dictionary. Keys that are not present are ignored.
| |
Replace |
Changes the value associated with a given key. If the dictionary does not contain
a key equal to the passed key, then an ArgumentException is thrown.
| |
Reversed |
Returns a View collection that can be used for enumerating the keys and values in the collection in
reversed order.
| |
ToArray |
Creates an array of the correct size, and copies all the items in the
collection into the array, by calling CopyTo.
(Inherited from CollectionBase<(Of <T>)>.) | |
ToString |
Shows the string representation of the dictionary. The string representation contains
a list of the mappings in the dictionary.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
TrueForAll |
Determines if all of the items in the collection satisfy the condition
defined by predicate.
(Inherited from CollectionBase<(Of <T>)>.) | |
TryGetValue |
Determines if this dictionary contains a key equal to key. If so, the value
associated with that key is returned through the value parameter.
(Overrides DictionaryBase<(Of <TKey, TValue>)>..::TryGetValue(TKey, TValue%).) |
Protected Methods
Name | Description | |
---|---|---|
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
Explicit Interface Implementations
Name | Description | |
---|---|---|
ICollection..::CopyTo |
Copies all the items in the collection into an array. Implemented by
using the enumerator returned from GetEnumerator to get all the items
and copy them to the provided array.
(Inherited from CollectionBase<(Of <T>)>.) | |
IDictionary..::Add |
Adds a key-value pair to the collection. If key or value are not of the expected types, an
ArgumentException is thrown. If both key and value are of the expected types, the (overridden)
Add method is called with the key and value to add.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
IDictionary..::Clear |
Clears this dictionary. Calls the (overridden) Clear method.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
IDictionary..::Contains |
Determines if this dictionary contains a key equal to key. The dictionary
is not changed. Calls the (overridden) ContainsKey method. If key is not of the correct
TKey for the dictionary, false is returned.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
IDictionary..::GetEnumerator |
Returns an enumerator that enumerates all the entries in the dictionary. Each entry is
returned as a DictionaryEntry.
The entries are enumerated in the same orders as the (overridden) GetEnumerator
method.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
IDictionary..::Remove |
Removes the key (and associated value) from the collection that is equal to the passed in key. If
no key in the dictionary is equal to the passed key, the
dictionary is unchanged. Calls the (overridden) Remove method. If key is not of the correct
TKey for the dictionary, the dictionary is unchanged.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
IEnumerable..::GetEnumerator |
Returns an enumerator that enumerates all the entries in the dictionary. Each entry is
returned as a DictionaryEntry.
The entries are enumerated in the same orders as the (overridden) GetEnumerator
method.
(Inherited from DictionaryBase<(Of <TKey, TValue>)>.) | |
ICloneable..::Clone |
Implements ICloneable.Clone. Makes a shallow clone of this dictionary; i.e., if keys or values are reference types, then they are not cloned.
|